export default {
  // Global page headers: https://go.nuxtjs.dev/config-head
  head: {
    title: process.env.npm_package_name || '云户Nuxt',//网站标题
    htmlAttrs: {
      lang: 'en'
    },
    meta: [
      { charset: 'utf-8' },//网站编码
      { name: 'viewport', content: 'width=device-width, initial-scale=1' },//移动端适配 设备宽度 缩放比1
      //nuxt 建议设置hid
      { hid: 'description', name: 'description', content: process.env.npm_package_description || '云户的初衷是建立一个平台，供互联网芸芸众生分享和汲取，合众人之力将互联网的精华抽丝剥离，形成有价值的资源。目前，还在努力朝着初衷努力。也希望有志者一起加入，大家一起努力' }
    ],
    link: [
      { rel: 'icon', type: 'image/x-icon', href: '/favicon.png' },
      { rel:'stylesheet',href:'http://libs.baidu.com/fontawesome/4.0.3/css/font-awesome.min.css'}
    ],
    // script:[
    //   {src:'https://code.jquery.com/jquery-3.6.0.min.js'}
    // ]
  },
  server: {
    port: 8000, // default: 3000
    host: '0.0.0.0' // default: localhost,
  },
  router:{
    middleware: 'auth',
    //扩展路由
    extendRoutes(routes,resolve){
      console.log(routes);
      routes.push({
        name:'root',//路由别名
        path:'/index',
        component: resolve(__dirname,'pages/index.vue')

      });

    }
  },
  //定义系统默认的loading效果，或者指定一个loading组件
  // loading: {color:'#000',height:'3px'},
  loading: '~/components/loading.vue',
  // Global CSS: https://go.nuxtjs.dev/config-css
  css: [
    'assets/css/transition.css',
    'assets/css/style.min.css',
    'element-ui/lib/theme-chalk/index.css',
    'assets/css/base.css',
  ],

  // Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
  plugins: [
    '~/plugins/router',//~当前项目根目录
    {
      src:'~/plugins/axios',
      ssr:true//开启服务端渲染
    },
    {
      src:'~/plugins/element-ui',
      ssr:true,//不支持ssr的插件只会在客户端渲染 不要设置为true
      // mode:'server'// client // v2.4+才会出现
    },
    '~/plugins/mixins'
  ],

  // Auto import components: https://go.nuxtjs.dev/config-components
  components: true,

  // Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
  buildModules: [    
    // https://go.nuxtjs.dev/typescript
    '@nuxt/typescript-build',
  ],

  // Modules: https://go.nuxtjs.dev/config-modules
  modules: [ //nuxtjs中自带的模块都需要在这里配置
    // https://go.nuxtjs.dev/axios
    '@nuxtjs/axios',
    //引入cookie插件
    'cookie-universal-nuxt',
    '@nuxtjs/style-resources'
  ],
  styleResources:{
    scss:[
      './assets/scss/global.scss'
    ]
  },

  // Axios module configuration: https://go.nuxtjs.dev/config-axios
  axios: {
    proxy: true,// 开启axios 跨域行为
    // prefix: '/api' //基本uri地址
  },
  proxy:{
    '/api/':{
      target:'http://localhost:8088/user', //代理转发的地址
      changeOrigin:true, //
      pathRewrite:{
        '^/api':''//将 api开头的路径替换为''
      }
    }
  },

  // Build Configuration: https://go.nuxtjs.dev/config-build
  build: {
    transpile:[/^element-ui/],
  }
}
